home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_h.lzh / devices / inputevent.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  7KB  |  230 lines

  1. #ifndef DEVICES_INPUTEVENT_H
  2. #define DEVICES_INPUTEVENT_H
  3. /*
  4. **    $Filename: devices/inputevent.h $
  5. **    $Release: 2.04 $
  6. **    $Revision: 36.7 $
  7. **    $Date: 91/01/22 $
  8. **
  9. **    input event definitions
  10. **
  11. **    (C) Copyright 1985,1986,1987,1988,1989 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef DEVICES_TIMER_H
  16. #include "devices/timer.h"
  17. #endif
  18.  
  19. /*----- constants --------------------------------------------------*/
  20.  
  21. /*  --- InputEvent.ie_Class --- */
  22. /* A NOP input event */
  23. #define IECLASS_NULL            0x00
  24. /* A raw keycode from the keyboard device */
  25. #define IECLASS_RAWKEY            0x01
  26. /* The raw mouse report from the game port device */
  27. #define IECLASS_RAWMOUSE        0x02
  28. /* A private console event */
  29. #define IECLASS_EVENT            0x03
  30. /* A Pointer Position report */
  31. #define IECLASS_POINTERPOS        0x04
  32. /* A timer event */
  33. #define IECLASS_TIMER            0x06
  34. /* select button pressed down over a Gadget (address in ie_EventAddress) */
  35. #define IECLASS_GADGETDOWN        0x07
  36. /* select button released over the same Gadget (address in ie_EventAddress) */
  37. #define IECLASS_GADGETUP        0x08
  38. /* some Requester activity has taken place.  See Codes REQCLEAR and REQSET */
  39. #define IECLASS_REQUESTER        0x09
  40. /* this is a Menu Number transmission (Menu number is in ie_Code) */
  41. #define IECLASS_MENULIST        0x0A
  42. /* User has selected the active Window's Close Gadget */
  43. #define IECLASS_CLOSEWINDOW        0x0B
  44. /* this Window has a new size */
  45. #define IECLASS_SIZEWINDOW        0x0C
  46. /* the Window pointed to by ie_EventAddress needs to be refreshed */
  47. #define IECLASS_REFRESHWINDOW        0x0D
  48. /* new preferences are available */
  49. #define IECLASS_NEWPREFS        0x0E
  50. /* the disk has been removed */
  51. #define IECLASS_DISKREMOVED        0x0F
  52. /* the disk has been inserted */
  53. #define IECLASS_DISKINSERTED        0x10
  54. /* the window is about to be been made active */
  55. #define IECLASS_ACTIVEWINDOW        0x11
  56. /* the window is about to be made inactive */
  57. #define IECLASS_INACTIVEWINDOW        0x12
  58. /* extended-function pointer position report (V36) */
  59. #define IECLASS_NEWPOINTERPOS        0x13
  60. /* Help key report during Menu session (V36) */
  61. #define IECLASS_MENUHELP        0x14
  62. /* the Window has been modified with move, size, zoom, or change (V36) */
  63. #define    IECLASS_CHANGEWINDOW        0x15
  64.  
  65. /* the last class */
  66. #define IECLASS_MAX            0x15
  67.  
  68.  
  69. /*  --- InputEvent.ie_SubClass --- */
  70. /*  IECLASS_NEWPOINTERPOS */
  71. /*    like IECLASS_POINTERPOS */
  72. #define IESUBCLASS_COMPATIBLE    0x00
  73. /*    ie_EventAddress points to struct IEPointerPixel */
  74. #define IESUBCLASS_PIXEL    0x01
  75. /*    ie_EventAddress points to struct IEPointerTablet */
  76. #define IESUBCLASS_TABLET    0x02
  77.  
  78. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  79.  * and IESUBCLASS_PIXEL.
  80.  *
  81.  * You specify a screen and pixel coordinates in that screen
  82.  * at which you'd like the mouse to be positioned.
  83.  * Intuition will try to oblige, but there will be restrictions
  84.  * to positioning the pointer over offscreen pixels.
  85.  *
  86.  * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  87.  */
  88. struct IEPointerPixel    {
  89.     struct Screen    *iepp_Screen;    /* pointer to an open screen */
  90.     struct {                /* pixel coordinates in iepp_Screen */
  91.     WORD    X;
  92.     WORD    Y;
  93.     }            iepp_Position;
  94. };
  95.  
  96. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  97.  * and IESUBCLASS_TABLET.
  98.  *
  99.  * You specify a range of values and a value within the range
  100.  * independently for each of X and Y (the minimum value of
  101.  * the ranges is always normalized to 0).
  102.  *
  103.  * Intuition will position the mouse proportionally within its
  104.  * natural mouse position rectangle limits.
  105.  *
  106.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  107.  */
  108. struct IEPointerTablet    {
  109.     struct {
  110.     UWORD    X;
  111.     UWORD    Y;
  112.     }            iept_Range;    /* 0 is min, these are max    */
  113.     struct {
  114.     UWORD    X;
  115.     UWORD    Y;
  116.     }            iept_Value;    /* between 0 and iept_Range    */
  117.  
  118.     WORD        iept_Pressure;    /* -128 to 127 (unused, set to 0)  */
  119. };
  120.  
  121.  
  122.  
  123. /*  --- InputEvent.ie_Code --- */
  124. /*  IECLASS_RAWKEY */
  125. #define IECODE_UP_PREFIX        0x80
  126. #define IECODE_KEY_CODE_FIRST        0x00
  127. #define IECODE_KEY_CODE_LAST        0x77
  128. #define IECODE_COMM_CODE_FIRST        0x78
  129. #define IECODE_COMM_CODE_LAST        0x7F
  130.  
  131. /*  IECLASS_ANSI */
  132. #define IECODE_C0_FIRST            0x00
  133. #define IECODE_C0_LAST            0x1F
  134. #define IECODE_ASCII_FIRST        0x20
  135. #define IECODE_ASCII_LAST        0x7E
  136. #define IECODE_ASCII_DEL        0x7F
  137. #define IECODE_C1_FIRST            0x80
  138. #define IECODE_C1_LAST            0x9F
  139. #define IECODE_LATIN1_FIRST        0xA0
  140. #define IECODE_LATIN1_LAST        0xFF
  141.  
  142. /*  IECLASS_RAWMOUSE */
  143. #define IECODE_LBUTTON            0x68    /* also uses IECODE_UP_PREFIX */
  144. #define IECODE_RBUTTON            0x69
  145. #define IECODE_MBUTTON            0x6A
  146. #define IECODE_NOBUTTON            0xFF
  147.  
  148. /*  IECLASS_EVENT (V36) */
  149. #define IECODE_NEWACTIVE        0x01    /* new active input window */
  150. #define IECODE_NEWSIZE            0x02    /* resize of window */
  151. #define IECODE_REFRESH            0x03    /* refresh of window */
  152.  
  153. /*  IECLASS_REQUESTER */
  154. /*    broadcast when the first Requester (not subsequent ones) opens up in */
  155. /*    the Window */
  156. #define IECODE_REQSET            0x01
  157. /*    broadcast when the last Requester clears out of the Window */
  158. #define IECODE_REQCLEAR            0x00
  159.  
  160.  
  161.  
  162. /*  --- InputEvent.ie_Qualifier --- */
  163. #define IEQUALIFIER_LSHIFT        0x0001
  164. #define IEQUALIFIER_RSHIFT        0x0002
  165. #define IEQUALIFIER_CAPSLOCK        0x0004
  166. #define IEQUALIFIER_CONTROL        0x0008
  167. #define IEQUALIFIER_LALT        0x0010
  168. #define IEQUALIFIER_RALT        0x0020
  169. #define IEQUALIFIER_LCOMMAND        0x0040
  170. #define IEQUALIFIER_RCOMMAND        0x0080
  171. #define IEQUALIFIER_NUMERICPAD        0x0100
  172. #define IEQUALIFIER_REPEAT        0x0200
  173. #define IEQUALIFIER_INTERRUPT        0x0400
  174. #define IEQUALIFIER_MULTIBROADCAST    0x0800
  175. #define IEQUALIFIER_MIDBUTTON        0x1000
  176. #define IEQUALIFIER_RBUTTON        0x2000
  177. #define IEQUALIFIER_LEFTBUTTON        0x4000
  178. #define IEQUALIFIER_RELATIVEMOUSE    0x8000
  179.  
  180. #define IEQUALIFIERB_LSHIFT        0
  181. #define IEQUALIFIERB_RSHIFT        1
  182. #define IEQUALIFIERB_CAPSLOCK        2
  183. #define IEQUALIFIERB_CONTROL        3
  184. #define IEQUALIFIERB_LALT        4
  185. #define IEQUALIFIERB_RALT        5
  186. #define IEQUALIFIERB_LCOMMAND        6
  187. #define IEQUALIFIERB_RCOMMAND        7
  188. #define IEQUALIFIERB_NUMERICPAD        8
  189. #define IEQUALIFIERB_REPEAT        9
  190. #define IEQUALIFIERB_INTERRUPT        10
  191. #define IEQUALIFIERB_MULTIBROADCAST    11
  192. #define IEQUALIFIERB_MIDBUTTON        12
  193. #define IEQUALIFIERB_RBUTTON        13
  194. #define IEQUALIFIERB_LEFTBUTTON        14
  195. #define IEQUALIFIERB_RELATIVEMOUSE    15
  196.  
  197. /*----- InputEvent -------------------------------------------------*/
  198.  
  199. struct InputEvent {
  200.     struct  InputEvent *ie_NextEvent;    /* the chronologically next event */
  201.     UBYTE   ie_Class;            /* the input event class */
  202.     UBYTE   ie_SubClass;        /* optional subclass of the class */
  203.     UWORD   ie_Code;            /* the input event code */
  204.     UWORD   ie_Qualifier;        /* qualifiers in effect for the event*/
  205.     union {
  206.     struct {
  207.         WORD    ie_x;        /* the pointer position for the event*/
  208.         WORD    ie_y;
  209.     } ie_xy;
  210.     APTR    ie_addr;        /* the event address */
  211.     struct {
  212.         UBYTE   ie_prev1DownCode;    /* previous down keys for dead */
  213.         UBYTE   ie_prev1DownQual;    /*   key translation: the ie_Code */
  214.         UBYTE   ie_prev2DownCode;    /*   & low byte of ie_Qualifier for */
  215.         UBYTE   ie_prev2DownQual;    /*   last & second last down keys */
  216.     } ie_dead;
  217.     } ie_position;
  218.     struct timeval ie_TimeStamp;    /* the system tick at the event */
  219. };
  220.  
  221. #define    ie_X            ie_position.ie_xy.ie_x
  222. #define    ie_Y            ie_position.ie_xy.ie_y
  223. #define    ie_EventAddress        ie_position.ie_addr
  224. #define    ie_Prev1DownCode    ie_position.ie_dead.ie_prev1DownCode
  225. #define    ie_Prev1DownQual    ie_position.ie_dead.ie_prev1DownQual
  226. #define    ie_Prev2DownCode    ie_position.ie_dead.ie_prev2DownCode
  227. #define    ie_Prev2DownQual    ie_position.ie_dead.ie_prev2DownQual
  228.  
  229. #endif    /* DEVICES_INPUTEVENT_H */
  230.